package com.bing.dao;


import com.bing.bean.weixin.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * Created by kaibb on 2014/11/23.
 */

@Repository
public interface UserDao {
    @Select("select * from User where openId=#{openId}")
    User findByOidAndType(User user);

    @Insert("insert into User(openId, nickName,command,latestActive) values(#{openId},#{nickName},#{command},#{latestActive}) ")
    @Options(useGeneratedKeys = true)
    int create(User user);

    @Update("update User set latestActive=#{latestActive} ,command =#{command}, historyCommands=#{historyCommands} where openId=#{openId}")
    void update(User user);
}
